import moment from 'moment'
// 全局过滤器
const flters = {
  transTime (display) {
    var date = new Date()
    date.setTime(display)
    var year = date.getFullYear()
    var month = date.getMonth() + 1
    var day = date.getDate()
    var hour = date.getHours()
    var minute = date.getMinutes()
    month = month < 10 ? '0' + month : month
    day = day < 10 ? '0' + day : day
    hour = hour < 10 ? '0' + hour : hour
    minute = minute < 10 ? '0' + minute : minute
    display = year + '-' + month + '-' + day + '  ' + '  ' + hour + ':' + minute
    return display
  },
  jobType (val) {
    let text = ''
    switch (val) {
      case 1: {
        text = '接人'
        break
      }
      case 2: {
        text = '送人'
        break
      }
      case 3: {
        text = '取货'
        break
      }
      case 4: {
        text = '送货'
        break
      }
      case 5: {
        text = '公务'
        break
      }
      case 6: {
        text = '调研'
        break
      }
      case 7: {
        text = '接待'
        break
      }
    }
    return text
  },
  activeName (val) {
    let text = ''
    switch (val) {
      case 0: {
        text = '首页'
        break
      }
      case 1: {
        text = '通信录'
        break
      }
      case 2: {
        text = '设置'
        break
      }
      case 3: {
        text = '我的'
        break
      }
    }
    return text
  },
  reviewStatusInfo (val) {
    let text = ''
    switch (val) {
      case 0: {
        text = '审核中'
        break
      }
      case 1: {
        text = '审核不通过'
        break
      }
      case 2: {
        text = '审核不通过'
        break
      }
      case 3: {
        text = '审核通过'
        break
      }
      case 4: {
        text = '已取消'
        break
      }
      case 5: {
        text = '不需要审核'
        break
      }
    }
    return text
  },
  carTypeInfo (val) {
    let text = ''
    switch (val) {
      case 1: {
        text = '小车'
        break
      }
      case 2: {
        text = '面包车'
        break
      }
      case 3: {
        text = '中巴车'
        break
      }
    }
    return text
  },
  momentHHmm (data) {
    let text = ''
    text = moment(data).format('YYYY-MM-DD HH:mm')
    return text
  }
}

export default flters
